﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace FileMonitor.Service.Tracking.Manager
{
    internal class DefaultTrackingTaskInvoker:ITrackingTaskInvoker
    {
        public void InvokeTask(ITracking trackingRouting, TrackingTask task)
        {
            switch (task.TaskType)
            {
                case TaskType.StartProcess:
                    trackingRouting.StartProcess(task.Process);
                    break;
                case TaskType.StopProcess:
                    trackingRouting.StopProcess(task.Process);
                    break;
                case TaskType.NewFile:
                    trackingRouting.InsertNewFile(task.Process, task.FilePath);
                    break;
                case TaskType.EndFile:
                    trackingRouting.CompleteFile(task.Process, task.FilePath);
                    break;
                case TaskType.ErrorFile:
                    trackingRouting.PreocessErrorFile(task.Process,task.FilePath,task.Exception);
                    break;
            }
        }
    }
}
